package com.example.dialogfragmentlibrary.library2;


import android.os.Parcel;
import android.os.Parcelable;

import androidx.fragment.app.DialogFragment;

import com.example.dialogfragmentlibrary.library.ViewHolder;

/**
 * 必须序列化,才能在savedInstanceState存取
 * 抽象类可以序列化，interface不可直接序列化
 */
public abstract class OnConvertViewListener implements Parcelable {
    public abstract void onConvertView(ViewHolder viewHolder, DialogFragment dialogFragment);

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {

    }

    public OnConvertViewListener() {
    }

    protected OnConvertViewListener(Parcel in) {
    }

    public static final Creator<OnConvertViewListener> CREATOR = new Creator<OnConvertViewListener>() {
        @Override
        public OnConvertViewListener createFromParcel(Parcel source) {
            return new OnConvertViewListener(source) {
                @Override
                public void onConvertView(ViewHolder viewHolder, DialogFragment dialogFragment) {

                }
            };
        }

        @Override
        public OnConvertViewListener[] newArray(int size) {
            return new OnConvertViewListener[size];
        }
    };
}
